using UnityEngine;

/// <summary>
/// GameObject对象池实现
/// </summary>
public class GameObjectPool : AbstractPool<GameObject>
{
    public GameObjectPool(IPoolFactory<GameObject> factory, int initialSize = 10, int maxSize = 100) 
        : base(factory, initialSize, maxSize)
    {
    }
    
    protected override void OnObjectSpawned(GameObject obj)
    {
        base.OnObjectSpawned(obj);
        obj.SetActive(true);
    }
    
    protected override void OnObjectReturned(GameObject obj)
    {
        base.OnObjectReturned(obj);
        obj.SetActive(false);
    }
}
